﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;

namespace Lapas.Common.Forms
{
    public partial class FilterForm : BaseForm
    {
        public DateTime FtFromDate { get; set; }
        public DateTime FtToDate { get; set; }
        public string FtUserCreate { get; set; }
        public decimal FtFromAmount { get; set; }
        public decimal FtToAmount { get; set; }
        public string FtCustomerId { get; set; }
        public string FtMaterialId { get; set; }
        public string FtWareHouse { get; set; }
        public bool isFilter { get; set; }

        public FilterForm()
        {
            InitializeComponent();
            isFilter = false;
        }

        private void txtMaterialId_Validated(object sender, EventArgs e)
        {
            txtMaterialId.Text = LookupControl.LookupControl.Instance().LookUpControl("MaterialId", "LiMaterial", txtMaterialId.Text.Trim(), false);
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                isFilter = true;
                FtFromDate = FromDate.Value;
                FtToDate = ToDate.Value;
                FtFromAmount = string.IsNullOrEmpty(txtFromAmount.Text.Trim()) ? 0 : Convert.ToDecimal(txtFromAmount.Text.Trim());
                FtToAmount = string.IsNullOrEmpty(txtToAmount.Text.Trim()) ? 0 : Convert.ToDecimal(txtToAmount.Text.Trim());
                FtCustomerId = txtCustomerId.Text.Trim();
                FtMaterialId = txtMaterialId.Text.Trim();
                FtUserCreate = txtUserCreate.Text.Trim();
                FtWareHouse = txtWarehouse.Text.Trim();
                this.Close();
            }
            catch (Exception ex)
            {
                isFilter = false;
                DisplayMessage.ShowError(ex.Message);
                this.Close();
            }
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            isFilter = false;
            this.Close();
        }

        
    }
}
